package internal

import (
	"github.com/gogf/gf/util/gconv"
)

type Message struct {
	Gateways []string
	MsgType string
	Content string
	Template string
	Data map[string]interface{}
}

func NewMessage(attribute map[string]interface{}, msgType string) *Message {
	var m *Message
	if err := gconv.Struct(attribute, &m); err != nil {
		panic(err)
	}
	m.MsgType = msgType
	return m
}

func (m *Message) GetMessageType() string {
	return m.MsgType
}

func (m *Message) GetContent() string {
	return m.Content
}

func (m *Message) GetTemplate() string {
	return m.Template
}

func (m *Message) GetData() map[string]interface{} {
	return m.Data
}

func (m *Message) GetGateways() []string {
	return m.Gateways
}

func (m *Message) SetMessageType(msgType string) *Message {
	m.MsgType = msgType
	return m
}

func (m *Message) SetContent(content string) *Message {
	m.Content = content
	return m
}

func (m *Message) SetTemplate(template string) *Message {
	m.Template = template
	return m
}

func (m *Message) SetData(data map[string]interface{}) *Message {
	m.Data = data
	return m
}

func (m *Message) SetGateways(gateways []string) *Message {
	m.Gateways = gateways
	return m
}